home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC]
/
NeXTSTEP 3.3 Dev Intel.iso
/
usr
/
sybase
/
doc
/
dbgetoff.man
< prev
next >
Wrap
Text File
|
1993-04-22
|
3KB
|
111 lines
1 Version 4.0 -- 5/1/89 dbgetoff
______________________________________________________________________
NAME: dbgetoff
FUNCTION:
Check for the existence of Transact-SQL constructs in the command
buffer.
SYNTAX:
int dbgetoff(dbproc, offtype, startfrom)
DBPROCESS *dbproc;
DBUSMALLINT offtype;
int startfrom;
dbgetoff Version 4.0 -- 5/1/89 2
______________________________________________________________________
COMMENTS:
o If the DBOFFSET option has been set (see the options manual
page), this routine can check for the location of certain
Transact-SQL constructs in the command buffer. As a simple
example, assume the program doesn't know the contents of the
command buffer but needs to know where the SQL keyword SELECT
appears:
int select_offset[10];
int last_offset;
int i;
/* set the offset option */
dbsetopt(dbproc, DBOFFSET, "select");
/* Assume the command buffer contains the following SELECTs */
3 Version 4.0 -- 5/1/89 dbgetoff
______________________________________________________________________
dbcmd(dbproc, "select x = 100 select y = 5");
/* send the query to SQL Server */
dbsqlexec(dbproc);
/* Get all the offsets to the SELECT keyword */
for (i = 0, last_offset = 0; last_offset != -1; i++)
if ((last_offset = dbgetoff(dbproc, OFF_SELECT, last_offset))
!= -1)
select_offset[i] = last_offset++;
In this example, select_offset[0] = 0 and select_offset[1] =
15.
PARAMETERS:
dbproc - A pointer to the DBPROCESS structure that provides the
connection for a particular front-end/SQL Server process. It
dbgetoff Version 4.0 -- 5/1/89 4
______________________________________________________________________
contains all the information that DB-Library uses to manage
communications and data between the front end and SQL Server.
offtype - The type of offset you want to find. The types are
defined in the header file sybdb.h and are:
OFF_SELECT
OFF_FROM
OFF_ORDER
OFF_COMPUTE
OFF_TABLE
OFF_PROCEDURE
OFF_STATEMENT
OFF_PARAM
OFF_EXEC
See the options manual page for details.
startfrom - The point in the buffer to start looking. The
5 Version 4.0 -- 5/1/89 dbgetoff
______________________________________________________________________
command buffer begins at 0.
RETURNS:
The character offset into the command buffer for the specified
offset. If the offset is not found, -1 is returned.
SEE ALSO:
dbcmd, dbgetchar, dbsetopt, dbstrcpy, dbstrlen, options